From 90f10d6980b8773d51501f1a37880394d4398c3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Fri, 10 Oct 2025 14:54:11 +0200 Subject: [PATCH] luci-base: add odhcpd feature detection MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For dnsmasq, feature detection is currently supported like this: L.hasSystemFeature('dnsmasq', 'dhcpv6') while for odhcpd, only a basic check is supported: L.hasSystemFeature('odhcpd') With this patch, a similar feature check is also possible for odhcpd, e.g.: L.hasSystemFeature('odhcpd', 'dhcpv6') Signed-off-by: David Härdeman --- .../luci-base/root/usr/share/rpcd/ucode/luci | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/root/usr/share/rpcd/ucode/luci b/modules/luci-base/root/usr/share/rpcd/ucode/luci index d32694788a..1e20634d4c 100644 --- a/modules/luci-base/root/usr/share/rpcd/ucode/luci +++ b/modules/luci-base/root/usr/share/rpcd/ucode/luci @@ -229,7 +229,6 @@ const methods = { offloading: access('/sys/module/xt_FLOWOFFLOAD/refcnt') == true || access('/sys/module/nft_flow_offload/refcnt') == true, br2684ctl: access('/usr/sbin/br2684ctl') == true, swconfig: access('/sbin/swconfig') == true, - odhcpd: access('/usr/sbin/odhcpd') == true, zram: access('/sys/class/zram-control') == true, sysntpd: readlink('/usr/sbin/ntpd') != null, ipv6: access('/proc/net/ipv6_route') == true, @@ -273,6 +272,25 @@ const methods = { fd.close(); } + result.odhcpd = false; + fd = popen('odhcpd -h 2>/dev/null'); + + if (fd) { + const output = fd.read('all'); + + if (output) { + result.odhcpd = {}; + const m = match(output, /^Features: (.+)$/s); + + for (let opt in split(m?.[1], ' ')) { + let f = replace(opt, 'no-', '', 1); + result.odhcpd[lc(f)] = (f == opt); + } + } + + fd.close(); + } + // This check can be removed after v25 release result.netifd_vrf = match(callPackageVersionCheck('netifd'), /^20[0-9][0-9]/s)?.[0] >= 2025; -- 2.30.2